﻿namespace MetaProperties.Framework
{
    /// <summary>
    /// Event arguments for when a property value changes.
    /// </summary>
    /// <typeparam name="T">The type of the value.</typeparam>
    public class ValueChangedEventArgs<T> : ValueChangedEventArgs
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ValueChangedEventArgs&lt;T&gt;"/> class.
        /// </summary>
        /// <param name="oldValue">The old value.</param>
        /// <param name="newValue">The new value.</param>
        public ValueChangedEventArgs(T oldValue, T newValue)
        {
            this.OldValue = oldValue;
            this.NewValue = newValue;
        }
    
        /// <summary>
        /// Gets the old value.
        /// </summary>
        /// <value>The old value.</value>
        public T OldValue { get; private set; }

        /// <summary>
        /// Gets the new value.
        /// </summary>
        /// <value>The new value.</value>
        public T NewValue { get; private set; }

        /// <summary>
        /// Gets the untyped old value.
        /// </summary>
        /// <value>The untyped old value.</value>
        public override object UntypedOldValue
        {
            get { return this.OldValue; }
        }

        /// <summary>
        /// Gets the untyped new value.
        /// </summary>
        /// <value>The untyped new value.</value>
        public override object UntypedNewValue
        {
            get { return this.NewValue; }
        }
    }
}
